<template>
    <div>
        <div
            style="   padding: 1.3125rem;    display: flex;   align-items: center; text-align: center; position: sticky;    top: 0;  z-index: 999;   background: #fff;justify-content: space-between; ">
            <img src="~/static/zixun/jiantou.png" alt="" style="width: 0.875rem; height: 0.875rem; object-fit: contain"
                @click="goBack" />
            <div style="font-weight: bold; font-size: 1rem; margin-left: 1.25rem">
                {{ title }}
            </div>
            <div style="width: 50px;">&nbsp;</div>
        </div>
      <div>
        <div  style="
              display: flex;
              align-items: center;
              margin: 0.5rem;
              justify-content: space-between;
              background: #edeef0;
              padding: 0.5rem;
              border-radius: 0.75rem;
            ">
                <div style="display: flex; align-items: center">
                    <div style="width: 36px; height: 36px; object-fit: cover">
                        <img :src="filicons.face" alt="" style="
                    width: 100%;
                    height: 100%;
                    border-radius: 50%;
                    object-fit: cover;
                  " />
                    </div>

                    <div style="margin-left: 0.75rem">
                        <div style="font-weight: 500; font-size: 0.8125rem">
                            {{ filicons?.fabu }}
                        </div>
                        <!-- <div style="font-size: .6875rem;color: #808080;margin-top:.25rem;">{{formattedTime(filicons.time)}}</div> -->
                    </div>
                </div>
                <!-- <div class="guanzhus">+关注</div> -->
            </div>
            <div v-html="filicons?.content_h5" class="rich-text-container"></div>
      </div>
    </div>
</template>
<script>
import md5 from 'js-md5';
export default {
    name: "Raiders",
    data() {
        return {
            title: "",
            id: '',
            uid: '',
            textToHash: '',
            t: '',
            filicons:''

        }

    },
    mounted() {
        this.title = this.$route.query.title;
        this.id = this.$route.query.id;
        this.uid = this.getCookie('loginnew');
        this.t = Date.now();
        const sign = `${this.uid}${this.t}fsd213ewdsadqwe2121213edsad`;
        this.textToHash = md5(sign);
        this.raiders()
    },
    methods: {
        raiders() {
            const params = {
                ct: 'shequ',
                ac: 'news_info',
                id: this.id,
                sign: this.textToHash,
                t: this.t,
                type: 0,
                uid: this.uid
            };
            this.$axios.get('api/app/v3', { params }).then((result) => {
                this.filicons = result.data.data;
                let base64String = result.data.data.content;
                base64String = base64String.replace(/[\s\n\r]+/g, ''); 
                this.filicons.content = atob(base64String); 
                // this.filicons.content= atob(  this.filicons.content)
            }).catch((err) => {

            });;
        },
        goBack() {
            this.$router.go(-1)
        },
        getCookie(name) {
      const value = `; ${document.cookie}`;
      const parts = value.split(`; ${name}=`);
      if (parts.length === 2) return parts.pop().split(';').shift();
      return '';
    },
    }
}
</script>
<style scoped>
.rich-text-container{
    margin: 0 20px;
}
</style>